export const request=(params)=>{
    // 定义公共的url
    // const baseUrl="https://dogborther.top/"
    const baseUrl="https://5x42011255.imdo.co/"
    const token = wx.getStorageSync('token')
    return new Promise((resolve,reject)=>{
        wx.request({
            ...params,
            header:{
                // token: token
                token:"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJib29rc2hvcCIsImlhdCI6MTY2MjAyNTMzNywiZXhwIjoxNjYyMjg0NTM3LCJvcGVuaWQiOiJvdFVlUjVDN01Mc2xyMERCTDFBRE91MzdJNDVNIiwic2Vzc2lvbl9rZXkiOiIxIiwidWlkIjoiMSJ9.QQceUfsZsoRxekEc_tln-rTr1_ViE8yyGPmqeRAZwi8"
            },
            url:baseUrl+params.url,
            success:(result)=>{
                if( result.data.code===0 ){
                    wx.showToast({
                        title: '登陆过期',
                        icon: 'error',
                        duration: 1500,
                        mask: false,
                        success: (result) => {
                            
                        },
                        fail: () => {},
                        complete: () => {}
                    });
                      
                }
                resolve(result);
            },
            fail:(err)=>{
                reject(err);
            }
        });
    }
    )
}